package com.pctc.config;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

@WebFilter(filterName = "encodingFilter",urlPatterns = "/*")
public class EncodingFilter  implements Filter {

    public void init(FilterConfig filterConfig) {}

    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        servletRequest.setCharacterEncoding("UTF-8");
        servletResponse.setCharacterEncoding("UTF-8");
        System.out.println("这是过滤器！！！！");
        System.out.println("这是过滤器111111");
        System.out.println("这是过滤器222222");
        System.out.println("这是过滤器333333");
        System.out.println("这是过滤器444444");
        System.out.println("这是过滤器555555");

        System.out.println("这是过滤器777777777777777777");
        System.out.println("this is my filter");

        System.out.println("我是pyk");
        filterChain.doFilter(servletRequest,servletResponse);
    }

    public void destroy() {}
}
